 <!-- box san pham 3 hang-->
 <?php
 if(!empty($category)){
    echo '
            <div class="cbox">
            
                <div class="cbox_header clearfix">
                    <span class="cbox_title block left">
                        '.$category->title.'
                    </span>
                    <span class="cbox_bg_midd block left"></span>                
                </div>
                
                <div class="cbox_content clearfix">
                    <div class="danhmuccon left clearfix">';
                    if(!empty($childcat)){
                        $t=0;
                        foreach ($childcat as $childcat){
                            ++$t;
                            echo ($t-1)%5==0?'<ul>':'';
                            echo '                            
                              <li><a href="'.base_url().$childcat->alias.'.1.html">'.$childcat->title.'</a></li>                                                     
                            ';
                            echo $t%5==0?'</ul>':'';
                        }
                    }
                        echo 
                        '
                        <div class="locsanpham clearfix">
                        <span class="block right">Xếp theo 
                            <select name="order" class="right ordercat">
                                <option value="1">A->Z</option>
                                <option value="2">Z->A</option>
                                <option value="3">Theo giá từ cao đến thấp</option>
                                <option value="4">Theo giá từ thấp đến cao</option>
                            </select>
                        </span>
                    </div><!-- end .loc san pham-->                        
                        
                    </div><!-- end .danhmuccon-->
                    
                    ';
                    if(!empty($product)){
                        $j=0;
                        foreach ($product as $product){
                            ++$j;
                           echo '
                           <div class="product3_box left clearfix">
                            <a href="'.base_url().$product->alias.'.8.html">
                                <img class="imgproduct"  src="'.$product->img.'" />
                                <span class="title_product block">'.$product->title.'</span>
                             </a>
                            <span class="price">Giá:'.$product->price.'</span>                       
                        </div>
                           '; 
                        echo $j%3==0? '<div style="clear:both;"></div>':'';
                        }
                    }else echo 'Không có sản phẩm nào';
                    
                    
                    echo $this->pagination->create_links(); 
                    echo '   
                </div> <!-- end cbox_content-->
            </div><!-- end cbox-->';
  }?>
            <!--end box san pham 3 hang-->
            <script>
$(document).ready(function(){
     //*******************order ajax****************************************
    $(".ordercat").change(function () {       
        var data= $(this).val();
        var url1 = '<?php echo base_url();?>mod_product/ajaxorder';
        $.ajax({
          		type: "POST",
          		url: url1,
          		data: {data: data},
                success: callback,
                error: err
        		});
         
        return false;
    });
   
    
    function callback(data, status){
        location.reload();
        //$("div .box_ajax").html(data);
      }
	function err(xhr, reason, ex){
	   alert('loi');
        $("div .box_ajax").html('loi');
      }
//*****************end order ajax******************/
});

</script>